import requests
import time

amount = 10 # amount of pictures you want to download
i = 1

while i < amount + 1:
    p = requests.get("https://thispersondoesnotexist.com/image") # gets the image from thispersondoesnotexist.com
    print(f"Downloading image number {i}...")
    try:
        out = open(f"{i}.jpg", "wb") # makes a file
        out.write(p.content) # writes downloaded image to the file
    except:
        print("An error occurred while downloading image.")
    time.sleep(0.5) # delay to let site refresh the image
    i = i + 1
out.close # closes the file creation
